package com.admin.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.admin.bean.GameDataBean;
import com.admin.dao.GameDataDao;

@Service("gameDataService")
public class GameDataService {

	@Autowired private GameDataDao gameDataDao;
	
	public int addGameDataBean(GameDataBean bean) {
		return gameDataDao.addGameDataBean(bean);
	}
	
	public int addVideoDataBean(GameDataBean bean) {
		return gameDataDao.addVideoDataBean(bean);
	}
	
	
	public List<GameDataBean> findDataByCpid(int cpid,int start,int limit){
		try {
			return gameDataDao.findDataByCpid(cpid,start,limit);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			
			return new ArrayList<GameDataBean>();
		} finally {

		}
	}
	
	
	public List<GameDataBean> findDataByCondition(String condition) {
		try {
			return gameDataDao.findDataByCondition(condition);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			
			return new ArrayList<GameDataBean>();
		} finally {

		}
	}
	
	
	public List<GameDataBean> findVideoByCondition(String condition) {
		try {
			return gameDataDao.findVideoByCondition(condition);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			
			return new ArrayList<GameDataBean>();
		} finally {

		}
	}
	
	
	public List<GameDataBean> findVideoByCpid(int cpid,int start,int limit){
		try {
			return gameDataDao.findVideoByCpid(cpid,start,limit);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			
			return new ArrayList<GameDataBean>();
		} finally {

		}
	}
	
	public int findDataCountByCpid(int cpid){
		try {
			return this.gameDataDao.findDataCountByCpid(cpid);
		} catch (Exception e) {
			e.printStackTrace();
			return 0;
			// TODO: handle exception
		} finally {

		}
	}
	
	
	public int findVideoCountByCpid(int cpid){
		try {
			return this.gameDataDao.findVideoCountByCpid(cpid);
		} catch (Exception e) {
			e.printStackTrace();
			return 0;
			// TODO: handle exception
		} finally {

		}
	}
}
